package com.lm.activemq.controller;

import com.lm.activemq.producer.MessageProducer;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/mq")
public class MQController {

    private final MessageProducer producer;

    @GetMapping("/queue")
    public String sendQueue(@RequestParam String msg) {
        producer.sendQueue(msg);
        return "Queue 发送成功";
    }

    @GetMapping("/topic")
    public String sendTopic(@RequestParam String msg) {
        producer.sendTopic(msg);
        return "Topic 发送成功";
    }
}
